home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
shopdrop.swf
/
scripts
/
__Packages
/
Crossfader.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
2KB
|
71 lines
class Crossfader extends MovieClip
{
var topVol = 60;
var crossFrames = 15;
var direction = -1;
function Crossfader()
{
super();
this.cVol = this.topVol;
this.volInc = this.topVol / this.crossFrames;
this.oSoundOne = this.mcOne.oSound = new Sound(this.mcOne);
this.oSoundTwo = this.mcTwo.oSound = new Sound(this.mcTwo);
this.oSoundOne.setVolume(this.topVol);
this.oSoundTwo.setVolume(0);
}
function updateFade()
{
this.cVol += this.direction * this.volInc;
this.oSoundOne.setVolume(this.cVol);
this.oSoundTwo.setVolume(this.topVol - this.cVol);
if(this.direction == -1)
{
if(this.cVol <= 0)
{
this.direction = 1;
this.onEnterFrame = null;
}
}
else if(this.cVol >= this.topVol)
{
this.direction = -1;
this.onEnterFrame = null;
}
}
function crossFade()
{
this.onEnterFrame = this.updateFade;
}
function fadeToOne()
{
if(this.direction == 1)
{
this.crossFade();
}
}
function fadeToTwo()
{
if(this.direction == -1)
{
this.crossFade();
}
}
function playMusic()
{
this.mcOne.play();
this.mcTwo.play();
}
function stopMusic()
{
this.oSoundOne.stop();
this.oSoundTwo.stop();
}
function reset()
{
this.direction = -1;
this.cVol = this.topVol;
this.oSoundOne.setVolume(this.topVol);
this.oSoundTwo.setVolume(0);
}
}